package org.csu.linkgame.service.ClassForDoubleGame;

import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import javafx.util.Duration;

public class Goals extends Pane{
        public static Timeline animation = null;
        public static int goals = 0;
        Label label = new Label("0");
        public Goals() {
            label.setFont(javafx.scene.text.Font.font(20));
            getChildren().add(label);
            animation = new Timeline(new KeyFrame(Duration.millis(10), e -> goalsLabel()));
            animation.setCycleCount(Timeline.INDEFINITE);
            animation.play();
        }
        public void goalsLabel() {
            this.goals = doubleGameData.goals;
            label.setText("您的当前得分为:"+goals);
        }
    }

